<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><style><!--/*paged media */ div.header {display: none }div.footer {display: none } /*@media print { */@page { size: A4; margin: 10%; @top-center {content: element(header) } @bottom-center {content: element(footer) } }/*element styles*/ .del  {text-decoration:line-through;color:red;} .ins {text-decoration:none;background:#c0ffc0;padding:1px;}
 /* TABLE STYLES */ 

 /* PARAGRAPH STYLES */ 
p.DocDefaults {display:block;margin-bottom: 4mm;line-height: 115%;font-size: 11.0pt;}
p.a {display:block;}
p.2 {display:block;page-break-after: avoid;margin-top: 4mm;margin-bottom: 0in;font-weight: bold;color: #4F81BD;font-size: 13.0pt;}
p.1 {display:block;page-break-after: avoid;margin-top: 0.33in;margin-bottom: 0in;font-weight: bold;color: #365F91;font-size: 14.0pt;}
p.ab {display:block;position: relative; margin-left: 0.5in;}
p.a4 {display:block;border-bottom-style: solid;border-bottom-width: 0.35mm;border-bottom-color: #4F81BD;margin-bottom: 0.21in;line-height: 100%;color: #17365D;font-size: 26.0pt;}
p.a8 {display:block;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;font-size: 12.0pt;}

 /* CHARACTER STYLES */ span.a0 {display:inline;}
span.HTML {display:inline;font-size: 10.0pt;}
span.aa {display:inline;font-weight: bold;}
span.a6 {display:inline;color: #0000FF;text-decoration: underline;}
--></style><script type="text/javascript"><!--function toggleDiv(divid){if(document.getElementById(divid).style.display == 'none'){document.getElementById(divid).style.display = 'block';}else{document.getElementById(divid).style.display = 'none';}}
--></script></head><body>
  
  <!-- userBodyTop goes here -->
    
  <div class="document">
  
  <p class="a4 a DocDefaults "><span class="" style="font-family: Cambria;">Docx4</span><span class="a0 " style="font-family: Cambria;">j</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="" style="">– </span><span class="" style="font-family: Cambria;">Начало Работы</span></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;white-space:pre-wrap;">Введение в </span><span class="" style="font-family: Cambria;">docx4</span><span class="a0 " style="font-family: Cambria;">j</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;">docx4j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> – это библиотека для работы с файлами формата docx, pptx и xlsx с использованием Java. По существу данная библиотека может распаковать «пакет» </span><span class="" style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (или </span><span class="" style="font-family: Calibri;">pptx/</span><span class="a0 " style="font-family: Calibri;">xlsx</span><span class="" style="font-family: Calibri;">)</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и разобрать </span><span class="a0 " style="font-family: Calibri;">XML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, чтобы создать представление в памяти </span><span class="a0 " style="font-family: Calibri;">Java</span><span class="" style="font-family: Calibri;">, используя дружественные классы разработки (в противоположность</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> к </span><span class="a0 " style="font-family: Calibri;">DOM</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и </span><span class="a0 " style="font-family: Calibri;">SAX</span><span class="" style="font-family: Calibri;">).</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">В целом эта библиотека схожа</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> со средствами разработки </span><span class="" style="font-family: Calibri;">Microsoft's</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">OpenXML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> SDK для .NET.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Сила </span><span class="" style="font-family: Calibri;">docx4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в том, что его представление в памяти использует </span><span class="a0 " style="font-weight: bold;;font-family: Calibri;">JAXB</span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">–</span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;white-space:pre-wrap;">стандарт </span><span class="a0 " style="font-family: Calibri;">JCP</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для связывания </span><span class="a0 " style="font-family: Calibri;">Java</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и </span><span class="a0 " style="font-family: Calibri;">XML</span><span class="" style="font-family: Calibri;">. В этом отношении</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> программа </span><span class="a0 " style="font-family: Calibri;">Aspose</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">похожа</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> на </span><span class="" style="font-family: Calibri;">docx4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">. В отличие от </span><span class="" style="font-family: Calibri;">docx4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> средства </span><span class="a0 " style="font-family: Calibri;">Apache</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">POI</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> используют </span><span class="a0 " style="font-family: Calibri;">XML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">Beans</span><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">docx4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> является библиотекой с </span><span class="" style="font-family: Calibri;">открытым исходным кодом</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> доступной по лицензии </span><span class="" style="font-family: Calibri;">Apache</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">License</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (v2). Как проект с </span><span class="" style="font-family: Calibri;">открытым исходным кодом</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">docx4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в основном улучшался за счёт вклада различных разработчиков </span><span class="" style="font-family: Calibri;">(смотри список авторов в README или POM файле).</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> Дальнейшие вклады в разработку </span><span class="" style="font-family: Calibri;">всегда приветствуются. Пожалуйста, смотрите</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> форум docx4j </span><a href="http://www.docx4java.org/forums/"><span class="a6 a0 " style="font-family: Calibri;">http://www.docx4java.org/forums/</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для деталей.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Проект docx4j спонсируется организацией </span><span class="" style="font-family: Calibri;">Plutext</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (</span><a href="http://www.plutext.com"><span class="a6 a0 " style="font-family: Calibri;">www.plutext.com</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">).</span></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;white-space:pre-wrap;">Введение в </span><span class="a0 " style="font-family: Cambria;">Open</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Cambria;">XML</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Согласно спецификации </span><span class="" style="font-family: Calibri;">Microsoft</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">Open</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">Packaging</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> каждый документ </span><span class="" style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> сделан из числа файлов </span><span class="" style="font-family: Calibri;">«Частей», которые запакованы в один архив.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Чтобы понять это, проще всего распаковать файл формата </span><span class="" style="font-family: Calibri;">docx/pptx/xlsx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, используя Ваш любимый архиватор. А ещё проще посетить страницу </span><a href="http://webapp.docx4java.org"><span class="a6 a0 " style="font-family: Calibri;">http://webapp.docx4java.org</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и исследовать Ваш файл, используя </span><span class="" style="font-family: Calibri;">“PartsList”. Вы также можете сгенерировать код таким же образом.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Часть документа (ЧД) – это обычно </span><span class="a0 " style="font-family: Calibri;">XML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, но не обязательно (часть-картинка, к примеру, не является </span><span class="a0 " style="font-family: Calibri;">XML</span><span class="" style="font-family: Calibri;">).</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Части документа составляют дерево. Если ЧД имеет частей-детей, то должна быть ЧД взаимосвязей, которая определяет это.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Часть документа, которая содержит основной текст, является Основной Частью Документа (Main</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">Document</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">Part). Каждая ЧД имеет имя. Обычно имя Основной Части Документа это "/word/document.xml".</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Если у документа есть колонтитул, то основная часть документа будет иметь потомственную ЧД колонтитул и это будет описано в части взаимосвязей основной части документа.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Аналогично для любых картинок. Чтобы посмотреть структуру любого документа, загрузите его на веб-приложение по ссылке </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="a6 a0 " style="font-family: Calibri;">the</span><span class="a6 a0 " style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a6 a0 " style="font-family: Calibri;">PartsList</span><span class="a6 a0 " style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a6 a0 " style="font-family: Calibri;">webapp</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">, или запустите пример "Parts</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">List" (смотрите далее).</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Введение в </span><span class="a0 " style="font-family: Calibri;">WordML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> выходит за рамки этого документа. Более подробно можно почитать в статье по ссылке </span><a href="http://compress.ru/Archive/CP/2006/6/116/"><span class="a6 a0 " style="font-family: Calibri;">http://compress.ru/Archive/CP/2006/6/116/</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Arial;">Англоязычные</span><span class="a0 " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Arial;white-space:pre-wrap;"> </span><span class="a0 " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Arial;">ресурсы</span><span class="a0 " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Arial;white-space:pre-wrap;">: </span><a href="http://www.ecma-international.org/publications/standards/Ecma-376.htm"><span class="a0 " style="color: #0000FF;text-decoration: underline;;font-family: Calibri;">http://www.ecma-international.org/publications/standards/Ecma-376.htm</span></a><span class="a0 " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Arial;white-space:pre-wrap;" /><span class="a0 " style="font-family: Calibri;white-space:pre-wrap;"> (</span><a href="http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm"><span class="a0 " style="color: #0000FF;text-decoration: underline;;font-family: Calibri;">http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm</span></a><span class="a0 " style="font-family: Calibri;white-space:pre-wrap;" /><span class="a0 " style="color: #0000FF;text-decoration: underline;;font-family: Calibri;">)</span><span class="a0 " style="font-family: Calibri;white-space:pre-wrap;">, </span><a href="http://openxmldeveloper.org/cfs-file.ashx/__key/communityserver-components-postattachments/00-00-00-19-70/Open-XML-Explained.pdf"><span class="a6 a0 " style="font-family: Calibri;white-space:pre-wrap;">"Open XML Explained" </span><span class="a6 a0 " style="font-family: Calibri;">ebook</span></a><span class="a0 " style="font-family: Calibri;white-space:pre-wrap;" /><span class="a0 " style="font-family: Calibri;">.</span></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;">Онлайн генерация кода</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Онлайн генерация находится по ссылке </span><a href="http://webapp.docx4java.org/"><span class="a6 a0 " style="color: #B85B5A;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Calibri;">http://webapp.docx4java.org</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Есть несколько вещей, которые Вы можете сделать уже прямо сейчас:</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: Calibri;white-space:pre-wrap;">Исследовать Ваш документ </span><span class="a0 " style="font-family: Calibri;">docx</span><span style="font-family: Calibri;">/</span><span class="a0 " style="font-family: Calibri;">pptx</span><span style="font-family: Calibri;">/</span><span class="a0 " style="font-family: Calibri;">xlsx</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;white-space:pre-wrap;">или его представление в </span><span style="font-family: Calibri;">docx</span><span style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: Calibri;white-space:pre-wrap;">Конвертировать </span><span class="a0 " style="font-family: Calibri;">docx</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;white-space:pre-wrap;">в </span><span class="a0 " style="font-family: Calibri;">PDF</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;white-space:pre-wrap;">или </span><span class="a0 " style="font-family: Calibri;">XSL</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">FO</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: Calibri;white-space:pre-wrap;">Объединить файлы </span><span class="a0 " style="font-family: Calibri;">docx</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;white-space:pre-wrap;">(</span><span style="font-family: Calibri;white-space:pre-wrap;">к примеру</span><span style="font-family: Calibri;white-space:pre-wrap;">, </span><span style="font-family: Calibri;white-space:pre-wrap;">обложка письма и контракт</span><span style="font-family: Calibri;white-space:pre-wrap;">) </span><span style="font-family: Calibri;white-space:pre-wrap;">в один файл </span><span class="a0 " style="font-family: Calibri;">docx</span><span style="font-family: Calibri;white-space:pre-wrap;">, </span><span style="font-family: Calibri;white-space:pre-wrap;">используя </span><span class="a0 " style="font-family: Calibri;">Plutext</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;white-space:pre-wrap;">расширение </span><span class="a0 " style="font-family: Calibri;">MergeDocx</span><span style="font-family: Calibri;white-space:pre-wrap;">. </span><span style="font-family: Calibri;white-space:pre-wrap;">Аналогично те же действия для файлов </span><span class="a0 " style="font-family: Calibri;">pptx</span><span style="font-family: Calibri;white-space:pre-wrap;">, </span><span style="font-family: Calibri;white-space:pre-wrap;">используя </span><span class="a0 " style="font-family: Calibri;">MergePptx</span><span style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Хотелось бы обратить внимание на первый пункт из списка</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> выше.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">После того как Вы загрузили Ваш документ </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">/</span><span class="a0 " style="font-family: Calibri;">pptx</span><span class="" style="font-family: Calibri;">/</span><span class="a0 " style="font-family: Calibri;">xlsx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, первое что Вы </span><span class="" style="font-family: Calibri;">увидите,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> будет прямо как в примере </span><span class="a0 " style="font-family: Calibri;">PartsList</span><span class="" style="font-family: Calibri;">:</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style=""><img height="651" id="rId16" src="Docx4j_Russian.docx_files/ac050bde-6cb6-4399-992a-36862a4ff6caimage1.png" width="450" /></span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Далее можно нажать на колонку слева, чтобы увидеть главную часть документа </span><span class="a0 " style="font-family: Calibri;">document</span><span class="" style="font-family: Calibri;">.</span><span class="a0 " style="font-family: Calibri;">xml</span><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">После нажатия можно увидеть </span><span class="a0 " style="font-family: Calibri;">XML</span><span class="" style="font-family: Calibri;">:</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style=""><img height="369" id="rId17" src="Docx4j_Russian.docx_files/ac050bde-6cb6-4399-992a-36862a4ff6caimage2.png" width="277" /></span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Там без сюрпризов.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Но обратите внимание на ссылки. </span><span class="" style="font-family: Calibri;">Нажимаем</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> на первый элемент </span><span class="a0 " style="font-family: Calibri;">w</span><span class="" style="font-family: Calibri;">:</span><span class="a0 " style="font-family: Calibri;">p</span><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Получаем исходный код </span><span class="a0 " style="font-family: Calibri;">Java</span><span class="" style="font-family: Calibri;">, который создаёт полную структуру:</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style=""><img height="564" id="rId18" src="Docx4j_Russian.docx_files/ac050bde-6cb6-4399-992a-36862a4ff6caimage3.png" width="450" /></span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Как Вы можете видеть на картинке выше, об</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">а стиля кода создаются для Вас. </span><span class="" style="font-family: Calibri;">В любом случае,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> Вы можете скопировать/вставить код в </span><span class="a0 " style="font-family: Calibri;">IDE</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (</span><span class="a0 " style="font-family: Calibri;">Eclipse</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">или другую среду разработки) и просто запустить его!</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Чтобы действительно увидеть созданный объект в документе Офиса, Вам всё-таки необходимо будет добавить созданный объект к части документа.</span></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;">Установка</span></p>
  
  <p class="2 a DocDefaults "><span class="" style="font-family: Cambria;white-space:pre-wrap;">Использование </span><span class="a0 " style="font-family: Cambria;">Maven</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Проект </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> доступен в центральном репозитории </span><span class="a0 " style="font-family: Calibri;">Maven</span><span class="" style="font-family: Calibri;">.</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> Это даёт возможность для пользователей </span><span class="a0 " style="font-family: Calibri;">Maven</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> начать работу с </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> действительно просто.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">С использованием </span><span class="a0 " style="font-family: Calibri;">Eclipse</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">и установленн</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">ого плагина </span><span class="a0 " style="font-family: Calibri;">m</span><span class="" style="font-family: Calibri;">2</span><span class="a0 " style="font-family: Calibri;">eclipse</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> Вы просто добавляете </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и всё. Нет необходимости в сложных манипуляциях с ручной установкой </span><span class="a0 " style="font-family: Calibri;">jar</span><span class="" style="font-family: Calibri;">-библиотек,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> путей классов и прочего.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Запись</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">в</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">блоге</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><a href="http://www.docx4java.org/blog/2011/10/hello-maven-central/"><span class="a6 a0 " style="font-family: Calibri;">hello</span><span class="a6 a0 " style="font-family: Calibri;">-</span><span class="a6 a0 " style="font-family: Calibri;">maven</span><span class="a6 a0 " style="font-family: Calibri;">-</span><span class="a6 a0 " style="font-family: Calibri;">central</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;"> рассказывает о том, что делать, начиная со свежей ОС (используется </span><span class="a0 " style="font-family: Calibri;">Windows</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> 7, но эти шаги также приведут к результату и на </span><span class="a0 " style="font-family: Calibri;">OSX</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и на </span><span class="a0 " style="font-family: Calibri;">Linux</span><span class="" style="font-family: Calibri;">).</span></p>
  
  <p class="2 a DocDefaults "><span class="" style="font-family: Cambria;">Использование библиотеки</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Если </span><span class="a0 " style="font-family: Calibri;">Maven</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> не для Вас, Вы можете скачать последнюю версию </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> по ссылке </span><a href="http://www.docx4java.org/docx4j/"><span class="a6 a0 " style="font-family: Calibri;">http://www.docx4java.org/docx4j/</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">В общем,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> мы предлагаем для разработки использовать текущую ночную сборку, так как последняя формальная выпущенная версия может отставать на несколько месяцев.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Поддерживаемые </span><span class="a0 " style="font-family: Calibri;">jar</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> библиотеки размещены в .tar.gz или zip файлах, а также в соответствующей </span><span class="" style="font-family: Calibri;">подпапке.</span></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;">Основные операции</span></p>
  
  <p class="2 a DocDefaults "><span class="" style="font-family: Cambria;">Открытие существующего документа</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java"><span class="a0 " style="font-family: Consolas;">org</span><span class="a0 " style="font-family: Consolas;">.</span><span class="a0 " style="font-family: Consolas;">docx</span><span class="a0 " style="font-family: Consolas;">4</span><span class="a0 " style="font-family: Consolas;">j</span><span class="a0 " style="font-family: Consolas;">.</span><span class="a0 " style="font-family: Consolas;">openpackaging</span><span class="a0 " style="font-family: Consolas;">.</span><span class="a0 " style="font-family: Consolas;">packages</span><span class="a0 " style="font-family: Consolas;">.</span><span class="a0 " style="font-weight: bold;;font-family: Consolas;">WordprocessingMLPackage</span></a><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;">представляет документ</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">docx</span><span style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Чтобы загрузить документ или файл “Flat OPC” XML, достаточно</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> вызвать одну функцию</span><span class="" style="font-family: Calibri;">:</span></p>
  
  <p class="a DocDefaults " style="position: relative; text-indent: 12mm;margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">WordprocessingMLPackage</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">wordMLPackage</span><span class="a0 " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> = </span><br />      </span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">WordprocessingMLPackage.load(new java.io.File(inputfilepath));</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;">В</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> 3.0 Вы можете использовать фасад:</span></p>
  
  <p class="a DocDefaults " style="position: relative; text-indent: 12mm;margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">WordprocessingMLPackage</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">wordMLPackage</span><span class="a0 " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> = </span><br />      </span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">Docx4J.load(</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;">new </span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">java.io.File(inputfilepath));</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: Calibri;">Он делает то</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">же самое, скрывая детали.</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: Calibri;">Для загрузки из входящего потока используются аналогичные сигнатуры.</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="" style="font-family: Calibri;">Вы можете получить главную часть документа (word/document.xml):</span></p>
  
  <p class="a DocDefaults " style="position: relative; text-indent: 12mm;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/MainDocumentPart.java"><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">MainDocumentPart</span></a><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;"> </span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">documentPart</span><span class="a0 " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> = </span></span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">wordMLPackage</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">.</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">getMainDocumentPart</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">(</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">);</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;">После этого Вы можете манипулировать с его содержимым.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Похожий подход используется при работе с файлами </span><span class="a0 " style="font-family: Calibri;">pptx</span><span class="" style="font-family: Calibri;">:</span></p>
  
  <p class="a DocDefaults " style="position: relative; text-indent: 12mm;margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #000000;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;">PresentationMLPackage presentationMLPackage = </span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: Consolas;">(PresentationMLPackage)OpcPackage.</span></span><span class="a0 " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: Consolas;">load</span><span class="a0 " style="color: #000000;font-size: 8.0pt;;font-family: Consolas;">(</span><span class="a0 " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: Consolas;">new</span><span class="a0 " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> java.io.File(inputfilepath));</span></span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">И аналогично для файлов xlsx.</span></p>
  
  <p class="2 a DocDefaults "><span class="" style="font-family: Cambria;">Создание нового документа</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="a0 " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Arial;white-space:pre-wrap;">Чтобы создать новый документ </span><span class="" style="font-family: Calibri;">docx:</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;"><span class="" style="font-family: Arial;white-space:pre-wrap;">    </span><span class="" style="font-family: Consolas;white-space:pre-wrap;">// </span></span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">Создать</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">пакет</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #000000;font-size: 9.0pt;;font-family: Consolas;">WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">// </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">Сохранить</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">его</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="font-size: 9.0pt;;font-family: Consolas;">wordMLPackage.save(new java.io.File("helloworld.docx") );</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;"><span class="" style="font-family: Arial;">И это всё.</span></span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Arial;white-space:pre-wrap;">Метод </span><span class="a0 " style="color: #000000;font-size: 9.0pt;;font-family: Consolas;">createPackage()</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> очень удобный, потому что он делает следующее:</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    // </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">Создать</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">пакет</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #000000;font-size: 9.0pt;;font-family: Consolas;">WordprocessingMLPackage wordMLPackage = new WordprocessingMLPackage();</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">// Создать главную часть документа </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">(word/document.xml)</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="font-size: 9.0pt;;font-family: Consolas;">MainDocumentPart wordDocumentPart = new MainDocumentPart();</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">// </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">Создать</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">содержимое</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">главной</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">части</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">документа</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #000000;font-size: 9.0pt;;font-family: Consolas;">ObjectFactory factory = Context.getWmlObjectFactory();</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #000000;font-size: 9.0pt;;font-family: Consolas;">org.docx4j.wml.Body body = factory .createBody();</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #000000;font-size: 9.0pt;;font-family: Consolas;">org.docx4j.wml.Document wmlDocumentEl = factory .createDocument();</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #000000;font-size: 9.0pt;;font-family: Consolas;">wmlDocumentEl.setBody(body);</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">// </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">Разместить содержимое в основной части</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #000000;font-size: 9.0pt;;font-family: Consolas;">wordDocumentPart.setJaxbElement(wmlDocumentEl);</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">            </span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">// </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">Добавить</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">основную</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">часть</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">в</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">часть</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">связей</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">// (создание</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">её</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">если</span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 9.0pt;;font-family: Consolas;">необходимо)</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #FFFFFF;font-size: 9.0pt;;font-family: Consolas;white-space:pre-wrap;">    </span><span class="a0 " style="color: #000000;font-size: 9.0pt;;font-family: Consolas;">wmlPack.addTargetPart(wordDocumentPart);</span></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;">Поиск</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="" style="font-family: Cambria;">с</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="" style="font-family: Cambria;">помощью</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Cambria;">TraversalUtil</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;">Файл</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><a href="https://github.com/plutext/docx4j/blob/master/src/main/java/org/docx4j/samples/OpenMainDocumentAndTraverse.java"><span class="a0 " style="color: #0000FF;text-decoration: underline;;font-family: Calibri;">OpenMainDocumentAndTraverse</span><span class="a0 " style="color: #0000FF;text-decoration: underline;;font-family: Calibri;">.</span><span class="a0 " style="color: #0000FF;text-decoration: underline;;font-family: Calibri;">java</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в папке примеров показывает</span><span class="" style="font-family: Calibri;">,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> как проходить по </span><span class="a0 " style="font-family: Calibri;">JAXB</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> представлению документа </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Данный подход является альтернативой </span><span class="a0 " style="font-family: Calibri;">XSLT</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, который не требует </span><span class="" style="font-family: Calibri;">маршаллирования</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в документ </span><span class="a0 " style="font-family: Calibri;">DOM</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и </span><span class="" style="font-family: Calibri;">потом</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> обратно.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Пример использует </span><span class="" style="font-family: Calibri;">TraversalUtil</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, который является главным подходом к прохождению по дереву объектов </span><span class="a0 " style="font-family: Calibri;">JAXB</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в основной части документа. </span><span class="" style="font-family: Calibri;">Метод</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> может бы</span><span class="" style="font-family: Calibri;">ть также применён к верхним или</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> нижним колонтитулам и т.п. </span><span class="a0 " style="font-family: Calibri;">TraversalUtil</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> имеет интерфейс </span><span class="a0 " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: Consolas;">interface</span><span class="a0 " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> Callback,</span></span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> который используется для указания каким образом </span><span class="" style="font-family: Calibri;">проходить узлы и что с ними делать.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Многие объекты (например,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> тело документа, параграф, поток) имеют список с их содержимым. </span><span class="" style="font-family: Calibri;">Про</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">ход работает с помощью итерации </span><span class="" style="font-family: Calibri;">по этим спискам.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Прохождение является очень полезным </span><span class="" style="font-family: Calibri;">средством</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для нахождения и изменения частей документа.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">К примеру, прохождение используется в docx4j 2.8.0, чтобы обеспечить способ создания </span><span class="a0 " style="font-family: Calibri;">HTML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">файлов без использования XSLT/Xalan.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Пакет </span><a href="https://github.com/plutext/docx4j/tree/master/src/main/java/org/docx4j/finders"><span class="a6 a0 " style="font-family: Calibri;">org.docx4j.finders</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;"> содержит классы, которые предоставляют удобный способ для нахождения различных объектов.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Часто это даже лучше, чем использование </span><span class="a0 " style="font-family: Calibri;">XPath</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (так как </span><span class="a0 " style="font-family: Calibri;">XPath</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">имеет ограничения</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в эталонной реализации </span><span class="a0 " style="font-family: Calibri;">JAXB</span><span class="" style="font-family: Calibri;">).</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Также в пакете </span><span class="a0 " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: Consolas;">package</span><span class="a0 " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> org.docx4j.utils:</span></span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;">/** </span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> * </span><span class="" style="font-family: Consolas;">Используйте,</span><span class="" style="font-family: Consolas;white-space:pre-wrap;"> если </span></span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">есть</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> только единственный тип объекта (</span><span class="" style="font-family: Consolas;white-space:pre-wrap;">например, </span></span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;">только </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">P),</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> * </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">с</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">которым</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">Вы</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: Consolas;">хотите что-либо сделать</span></span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">.</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: Consolas;">public</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: Consolas;">class</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;">SingleTraversalUtilVisitorCallback</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="font-family: Calibri;">ImageConvertEmbeddedToLinked</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">пример</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">содержит вариант использования описанного выше.</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;">/** </span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> * </span></span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">Используйте</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;">, </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">если</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">имеется</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">более</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">одного</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">типа</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">объекта</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> (</span></span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">например</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;">, </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">таблицы</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">и</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">параграфы),</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> * </span></span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">с</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">которыми</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">Вы</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">хотите</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">что-либо</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">сделать</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">при</span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F5FBF;font-size: 10.0pt;;font-family: Consolas;">обходе.</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: Consolas;">public</span><span class="a0 " style="color: #000000;font-size: 10.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: Consolas;">class</span><span class="a0 " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;"> CompoundTraversalUtilVisitorCallback</span></span></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;">Преобразование</span><span class="a0 " style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="" style="font-family: Cambria;">с</span><span class="a0 " style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="" style="font-family: Cambria;">помощью</span><span class="a0 " style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Cambria;">docx4j</span></p>
  
  <p class="2 a DocDefaults "><span class="a0 " style="font-family: Cambria;">docx</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="" style="font-family: Cambria;">в</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> (</span><span class="a0 " style="font-family: Cambria;">X</span><span class="" style="font-family: Cambria;">)</span><span class="a0 " style="font-family: Cambria;">HTML</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">может</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">конвертировать</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">в</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">HTML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">или</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">XHTML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">. При этом генерируемый </span><span class="a0 " style="font-family: Calibri;">HTML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> получается чистым (в отличие от того </span><span class="a0 " style="font-family: Calibri;">HTML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, который производит </span><span class="a0 " style="font-family: Calibri;">Word</span><span class="" style="font-family: Calibri;">).</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Преобразование</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в </span><span class="a0 " style="font-family: Calibri;">HTML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> с помощью </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">может быть применено</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для документов, которые содержат параграфы, таблицы и картинки. Он</span><span class="" style="font-family: Calibri;">о</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> не справляется с более экзотичными вещами как уравнения, </span><span class="a0 " style="font-family: Calibri;">SmartArt</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> или </span><span class="a0 " style="font-family: Calibri;">WordArt</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (</span><span class="a0 " style="font-family: Calibri;">DrawingML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> или </span><span class="a0 " style="font-family: Calibri;">VML</span><span class="" style="font-family: Calibri;">).</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">В интернете Вы можете найти </span><span class="a0 " style="font-family: Calibri;">XSLT</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">преобразование,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> которое конвертирует </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в </span><span class="a0 " style="font-family: Calibri;">HTML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">. Однако это преобразование очень сложное, так как оно должно </span><span class="" style="font-family: Calibri;">извлекать эффективное форматирование из иерархии.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Для сравнения в </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> эта логика реализована в </span><span class="a0 " style="font-family: Calibri;">Java</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">. В результате </span><span class="a0 " style="font-family: Calibri;">XSLT</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> преобразование в </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> очень простое (функции расширения </span><span class="a0 " style="font-family: Calibri;">XSLT</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для </span><span class="a0 " style="font-family: Calibri;">Java</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">делают эту тяжелую работу).</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">В </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> Вы можете получить результат, используя </span><span class="a0 " style="font-family: Calibri;">XSLT</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> или проходя по документу в </span><span class="a0 " style="font-family: Calibri;">Java</span><span class="" style="font-family: Calibri;">. Фасад позволяет Вам выбрать, что делать:</span></p>
  
  <p class="a DocDefaults " style="position: relative; margin-left: 12mm;text-indent: 12mm;margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">//Применять</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">экспортер</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;">, </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">который</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">использует</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">xsl</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">трансформацию</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #000000;font-size: 8.0pt;">      </span><span class="a0 " style="color: #000000;font-size: 8.0pt;;font-family: Consolas;">Docx4J.</span><span class="a0 " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: Consolas;">toHTML</span><span class="a0 " style="color: #000000;font-size: 8.0pt;;font-family: Consolas;">(htmlSettings, os, Docx4J.</span><span class="a0 " style="color: #0000C0;font-style: italic;font-size: 8.0pt;;font-family: Consolas;">FLAG_EXPORT_PREFER_XSL</span><span class="a0 " style="color: #000000;font-size: 8.0pt;;font-family: Consolas;">);</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #000000;font-size: 8.0pt;">      </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">//Применять</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">экспортер</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;">, </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">который</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">не</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">использует</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">xsl</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> трансформацию (= </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">использует</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;"> </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">инспектор)</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">//</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;">      </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">Docx4J.toHTML(htmlSettings</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;">, </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: Consolas;">os</span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;white-space:pre-wrap;">, </span><span class="a0 " style="color: #3F7F5F;font-size: 8.0pt;;font-family: Consolas;">Docx4J.FLAG_EXPORT_PREFER_NONXSL);</span></p>
  
  <p class="a DocDefaults "> </p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Смотрите</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">пример</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">на</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">GitHub</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">по</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">ссылке</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><a href="https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutHtml.java"><span class="a6 a0 " style="font-family: Calibri;">src</span><span class="a6 a0 " style="font-family: Calibri;">/</span><span class="a6 a0 " style="font-family: Calibri;">samples</span><span class="a6 a0 " style="font-family: Calibri;">/</span><span class="a6 a0 " style="font-family: Calibri;">docx</span><span class="a6 a0 " style="font-family: Calibri;">4</span><span class="a6 a0 " style="font-family: Calibri;">j</span><span class="a6 a0 " style="font-family: Calibri;">/</span><span class="a6 a0 " style="font-family: Calibri;">org</span><span class="a6 a0 " style="font-family: Calibri;">/</span><span class="a6 a0 " style="font-family: Calibri;">docx</span><span class="a6 a0 " style="font-family: Calibri;">4</span><span class="a6 a0 " style="font-family: Calibri;">j</span><span class="a6 a0 " style="font-family: Calibri;">/</span><span class="a6 a0 " style="font-family: Calibri;">samples</span><span class="a6 a0 " style="font-family: Calibri;">/</span><span class="a6 a0 " style="font-family: Calibri;">ConvertOutHtml</span><span class="a6 a0 " style="font-family: Calibri;">.</span><span class="a6 a0 " style="font-family: Calibri;">java</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="a6 a0 " style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Если вывод в лог включен, то всё что не выполнено, будет видно в </span><span class="" style="font-family: Calibri;">выходном документе.</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;white-space:pre-wrap;">Если не включен уровень </span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;">вывода</span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;">для отладки</span><span class="a0 " style="font-weight: bold;font-style: italic;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">, то неподдерживаемые элементы будут </span></span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;">молча</span><span class="a0 " style="font-weight: bold;font-style: italic;"><span class="" style="font-family: Calibri;white-space:pre-wrap;"> опущены.</span></span></p>
  
  <p class="2 a DocDefaults "><span class="a0 " style="font-family: Cambria;">docx</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> в </span><span class="a0 " style="font-family: Cambria;">PDF</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> создаёт </span><span class="a0 " style="font-family: Calibri;">XSL</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">FO</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, который может быть использован для создания </span><span class="a0 " style="font-family: Calibri;">PDF</span><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Вы можете попробовать это преобразование с помощью онлайн демонстрации по адресу </span><a href="http://webapp.docx4java.org/OnlineDemo/docx_to_pdf_fop.html"><span class="a6 a0 " style="font-family: Calibri;">http://webapp.docx4java.org/OnlineDemo/docx_to_pdf_fop.html</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">В общем, преобразование в </span><span class="a0 " style="font-family: Calibri;">PDF</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> с помощью </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> может быть применено для документов, которые содержат параграфы, таблицы и картинки. Оно не справляется с более экзотичными вещами как уравнения, </span><span class="a0 " style="font-family: Calibri;">SmartArt</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> или </span><span class="a0 " style="font-family: Calibri;">WordArt</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (</span><span class="a0 " style="font-family: Calibri;">DrawingML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> или </span><span class="a0 " style="font-family: Calibri;">VML</span><span class="" style="font-family: Calibri;">).</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">В настоящее время </span><span class="a0 " style="font-family: Calibri;">Apache</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">FOP</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> совмещен с </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для создания </span><span class="a0 " style="font-family: Calibri;">PDF</span><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;"> Смотрите пример на </span><span class="a0 " style="font-family: Calibri;">GitHub</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> по ссылке </span><a href="https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutPDF.java"><span class="a6 a0 " style="font-family: Calibri;">src/samples/docx4j/org/docx4j/samples/ConvertOutPDF.java</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Если вывод в лог включен, то всё что не выполнено, будет видно в выходном документе.</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;white-space:pre-wrap;">Если не включен уровень </span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;">вывода</span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;">для отладки</span><span class="a0 " style="font-weight: bold;font-style: italic;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">, то неподдерживаемые элементы будут </span></span><span class="a0 " style="font-weight: bold;font-style: italic;;font-family: Calibri;">молча</span><span class="a0 " style="font-weight: bold;font-style: italic;"><span class="" style="font-family: Calibri;white-space:pre-wrap;"> опущены.</span></span></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;white-space:pre-wrap;">Импорт </span><span class="a0 " style="font-family: Cambria;">XHTML</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="a0 " style="background-color: #FFFFFF;"><span class="" style="font-family: Calibri;">Начиная с версии 2.8.0</span></span><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;">,</span><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;">docx4j</span><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;white-space:pre-wrap;"> может конвертировать содержимое </span><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;">XHTML</span><span class="a0 " style="background-color: #FFFFFF;"><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (параграфы, таблицы, картинки) в родной язык </span></span><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;">WordML</span><span class="a0 " style="background-color: #FFFFFF;"><span class="" style="font-family: Calibri;white-space:pre-wrap;"> с почти тем же самым форматированием. Если Вы собираетесь использовать это, крайне рекомендуется применять версию </span></span><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;">3.</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;">Смотрите примеры на </span><a href="https://github.com/plutext/docx4j-ImportXHTML/tree/master/src/samples"><span class="a6 a0 " style="font-family: Calibri;">https://github.com/plutext/docx4j-ImportXHTML/tree/master/src/samples</span></a><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;" /></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;">Новое</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="" style="font-family: Cambria;">в</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="" style="font-family: Cambria;">версии</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> 3</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Библиотека </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">3.0</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> содержит много изменений больших и маленьких. Вот наиболее заметные (смотрите </span><a href="https://github.com/plutext/docx4j/blob/master/CHANGELOG.md"><span class="a6 a0 " style="font-family: Calibri;">лог изменения</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для остальных).</span></p>
  
  <p class="2 a DocDefaults "><span class="a0 " style="background-color: #FFFFFF;;font-family: Cambria;">slf4j</span><span class="a0 " style="background-color: #FFFFFF;;font-family: Cambria;white-space:pre-wrap;"> </span><span class="a0 " style="background-color: #FFFFFF;;font-family: Cambria;">вместо</span><span class="a0 " style="background-color: #FFFFFF;;font-family: Cambria;white-space:pre-wrap;"> </span><span class="a0 " style="background-color: #FFFFFF;;font-family: Cambria;">log4j</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Начиная с версии 3, </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> использует </span><span class="a0 " style="font-family: Calibri;">slf</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Для работы с </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> Вам необходимо добавить </span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;">slf4j </span><span class="" style="font-family: Calibri;white-space:pre-wrap;">в путь к классу. Как написано на сайте </span><span class="" style="font-family: Calibri;">slf4j:</span></p>
  
  <p class="a DocDefaults " style="position: relative; margin-left: 12mm;"><span class="a0 " style="color: #777777;background-color: #FFFFFF;font-size: 10.0pt;"><span class="" style="font-family: Verdana;">Простой Фасад Логирования для Java (SLF4J) выступает как простой фасад или абстракция для различных фрэймфорков логирования (к примеру, java.util.logging, logback, log4j), позволяя конечному пользователю</span><span class="" style="font-family: Verdana;white-space:pre-wrap;"> подключить желаемый фрэймворк логирования во время развёртывания продукта.</span></span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Таким образом, необходимо, чтобы </span><span class="a0 " style="font-family: Calibri;">jar</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> файл </span><span class="a0 " style="font-family: Calibri;">slf</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">api</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">был добавлен в путь к классу:</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Verdana;white-space:pre-wrap;">  </span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">dependency</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;">    &lt;</span></span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">groupId</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span><span class="a0 " style="font-size: 9.5pt;;font-family: Consolas;">org.slf4j</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;/</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">groupId</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;">    &lt;</span></span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">artifactId</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span><span class="a0 " style="font-size: 9.5pt;;font-family: Consolas;">slf4j-api</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;/</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">artifactId</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;">    &lt;</span></span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">version</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span><span class="a0 " style="font-size: 9.5pt;;font-family: Consolas;">1.7.5</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;/</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">version</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;white-space:pre-wrap;">  </span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;/</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">dependency</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults "> </p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Если Вы хотите использовать </span><span class="a0 " style="font-family: Calibri;">log</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;">, тогда добавьте его:</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;white-space:pre-wrap;">  </span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">dependency</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;">    &lt;</span></span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">groupId</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span><span class="a0 " style="font-size: 9.5pt;;font-family: Consolas;">org.slf4j</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;/</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">groupId</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;">    &lt;</span></span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">artifactId</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span><span class="a0 " style="font-size: 9.5pt;;font-family: Consolas;">slf4j-log4j12</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;/</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">artifactId</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: Consolas;white-space:pre-wrap;">    &lt;</span></span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">version</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span><span class="a0 " style="font-size: 9.5pt;;font-family: Consolas;">1.7.5</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;/</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">version</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;white-space:pre-wrap;">  </span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&lt;/</span><span class="a0 " style="color: #A31515;font-size: 9.5pt;;font-family: Consolas;">dependency</span><span class="a0 " style="color: #0000FF;font-size: 9.5pt;;font-family: Consolas;">&gt;</span></p>
  
  <p class="a DocDefaults "> </p>
  
  <p class="2 a DocDefaults "><span class="" style="font-family: Cambria;white-space:pre-wrap;">Импорт </span><span class="a0 " style="font-family: Cambria;">XHTML</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="a0 " style="background-color: #FFFFFF;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Начиная с версии 3, функциональность импорта </span></span><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;">XHTML</span><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;white-space:pre-wrap;"> является отдельным проектом на </span><a href="https://github.com/plutext/docx4j-ImportXHTML"><span class="a6 a0 " style="background-color: #FFFFFF;font-size: 10.0pt;;font-family: Calibri;">GitHub</span></a><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;white-space:pre-wrap;" /><span class="a0 " style="background-color: #FFFFFF;;font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Причина переноса в отдельный проект заключается в зависимости Maven – Flying Saucer, который лицензируется по LGPL v2.1</span><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (в отличие от лицензии </span></span><span class="a0 " style="color: #000000;;font-family: Calibri;">ASL</span><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="color: #000000;;font-family: Calibri;">v2</span><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">, которая используется другими зависимостями </span></span><span class="a0 " style="color: #000000;;font-family: Calibri;">docx4j).</span><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;"> </span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Если Вы хотите использовать эту функциональность, Вам необходимо добавить эти </span></span><span class="a0 " style="color: #000000;;font-family: Calibri;">jar</span><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;">файлы в путь к классу.</span></span></p>
  
  <p class="2 a DocDefaults "><span class="" style="font-family: Cambria;">Фасад</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Cambria;">docx</span><span class="" style="font-family: Cambria;">4</span><span class="a0 " style="font-family: Cambria;">j</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Версия 3.0 содержит </span><a href="https://github.com/plutext/docx4j/blob/master/src/main/java/org/docx4j/Docx4J.java"><span class="a6 a0 " style="font-family: Calibri;">фасад</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">, который обеспечивает чистый доступ к</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">типичным</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">использованиям</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">: </span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: Calibri;white-space:pre-wrap;">загрузка </span><span style="font-family: Calibri;">документа</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: Calibri;">сохранение документа</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: Calibri;white-space:pre-wrap;">связывание </span><span class="a0 " style="font-family: Calibri;">XML</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;">с кон</span><span style="font-family: Calibri;">тролем содержимого в документе</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span style="font-family: Calibri;white-space:pre-wrap;">экспорт документа </span><span style="font-family: Calibri;">(</span><span style="font-family: Calibri;white-space:pre-wrap;">в </span><span class="a0 " style="font-family: Calibri;">HTML</span><span style="font-family: Calibri;white-space:pre-wrap;">, </span><span class="a0 " style="font-family: Calibri;">PDF</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;white-space:pre-wrap;">и другие форматы</span><span style="font-family: Calibri;white-space:pre-wrap;">, </span><span style="font-family: Calibri;white-space:pre-wrap;">поддерживаемые рендерером </span><span class="a0 " style="font-family: Calibri;">FO</span><span style="font-family: Calibri;">)</span><span style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Применение </span><span class="" style="font-family: Calibri;">загрузки и сохранения документа с помощью</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> фасада можно посмотреть в примере </span><a href="https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/OpenAndSaveRoundTripTest.java" target="_blank"><span class="a6 a0 " style="color: #0857A6;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Calibri;">OpenAndSaveRoundTripTest.java</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Посмотреть, как используется фасад</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для вызова экспорта документов можно в примерах </span><a href="https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutHtml.java" target="_blank"><span class="a6 a0 " style="color: #0857A6;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Calibri;">ConvertOutHtml.java</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и </span><a href="https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutPDF.java" target="_blank"><span class="a6 a0 " style="color: #0857A6;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Calibri;">ConvertOutPDF.java</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="2 a DocDefaults "><span class="a0 " style="font-family: Cambria;">MOXy</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;">docx4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> использует </span><span class="a0 " style="font-family: Calibri;">JAXB</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для </span><span class="" style="font-family: Calibri;">маршаллирования</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-family: Calibri;">XML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> частей в </span><span class="" style="font-family: Calibri;">docx/pptx/xlsx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и обратной процедуры.</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="font-family: Calibri;">JAXB</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> включен в набор Sun Java 6, но не в 1.5. Так что если Вы используете 1.5 </span><span class="a0 " style="font-family: Calibri;">JDK</span><span class="" style="font-family: Calibri;">, Вам необходимо будет добавить JAXB 2.1.x в путь к классу.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Вы так же можете использовать ссылку на реализацию </span><span class="a0 " style="font-family: Calibri;">JAXB</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> (к примеру, v2.2.4). Если Вы хотите использовать такую реализацию вместо версии, включенной в </span><span class="a0 " style="font-family: Calibri;">JDK</span><span class="" style="font-family: Calibri;">, делайте это с помощью механизма поддерживаемого каталога (endorsed directory mechanism).</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">В </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> 3.0 же Вы можете выбрать </span><a href="http://www.eclipse.org/eclipselink/moxy.php"><span class="a6 a0 " style="color: #B85B5A;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Calibri;">EclipseLink MOXy</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">для использования вместо этого. Чтобы это</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> сделать, просто включите </span><a href="http://www.docx4java.org/docx4j/docx4j-MOXy-JAXBContext-3.0.0.jar"><span class="a6 a0 " style="color: #B85B5A;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Calibri;">docx4j-MOXy-JAXBContext-3.0.0.jar</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и </span><span class="a0 " style="font-family: Calibri;">jar</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> файлы </span><span class="a0 " style="font-family: Calibri;">MOXy</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в путь к классу.</span></p>
  
  <p class="2 a DocDefaults "><span class="" style="font-family: Cambria;">Примеры кода</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Примеры </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> переехали на адрес </span><a href="https://github.com/plutext/docx4j/tree/master/src/samples"><span class="a6 a0 " style="color: #B85B5A;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Calibri;">src/samples</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="1 a DocDefaults "><span class="" style="font-family: Cambria;">Коммерческие</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> </span><span class="" style="font-family: Cambria;">расширения</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">В принципе, свободно скачиваемая библиотека </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> с открытым исходным кодом не накладывает никаких ограничений на то, что Вы можете сделать с её помощью, кроме тех накладываемых лицензией </span><span class="a0 " style="font-family: Calibri;">Apache</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">на программное обеспечение.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;">Однако есть вещи,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> которые Вы бы хотели сделать, но требуют</span><span class="" style="font-family: Calibri;">,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> честно говоря</span><span class="" style="font-family: Calibri;">,</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> глубокого понимания формата файлов </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">/</span><span class="a0 " style="font-family: Calibri;">pptx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и </span><span class="" style="font-family: Calibri;">написания</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> большего количества </span><span class="" style="font-family: Calibri;">кода:</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span class="a0 " style="font-weight: bold;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Объединить/добавить </span></span><span class="a0 " style="font-weight: bold;;font-family: Calibri;">docx</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;">файлы</span><span style="font-family: Calibri;">, </span><span style="font-family: Calibri;">без изменения форматирования</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span class="a0 " style="font-weight: bold;"><span class="" style="font-family: Calibri;">Объединить/добавить</span></span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-weight: bold;;font-family: Calibri;">pptx</span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;">файлы</span><span style="font-family: Calibri;">, </span><span style="font-family: Calibri;">без изменения форматирования</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;">Сделать оглавление </span><span style="font-family: Calibri;white-space:pre-wrap;">в </span><span class="a0 " style="font-family: Calibri;">docx</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span>­<span>– </span><span style="font-family: Calibri;">генерация или обновление с номерами страниц</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;">Вставка </span><span class="a0 " style="font-weight: bold;;font-family: Calibri;">OLE</span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;">объектов</span><span style="font-family: Calibri;">,</span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;">таких</span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;white-space:pre-wrap;">как </span><span class="a0 " style="font-family: Calibri;">PDF</span><span style="font-family: Calibri;white-space:pre-wrap;">, </span><span class="a0 " style="font-family: Calibri;">video</span><span style="font-family: Calibri;white-space:pre-wrap;"> </span><span style="font-family: Calibri;white-space:pre-wrap;">и прочего в </span><span class="a0 " style="font-family: Calibri;">docx</span><span style="font-family: Calibri;">/</span><span class="a0 " style="font-family: Calibri;">pptx</span><span style="font-family: Calibri;">/</span><span class="a0 " style="font-family: Calibri;">xlsx</span></p>
  
  <p class="ab a DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: -0.25in;">•  <span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;">Редактирование документов </span><span class="a0 " style="font-weight: bold;;font-family: Calibri;">docx</span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="font-weight: bold;;font-family: Calibri;white-space:pre-wrap;">онлайн </span><span style="font-family: Calibri;">в браузере</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Коммерческая редакция </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> имеет встроенную поддержку для всех описанных выше случаев, а также включает выделенную коммерческую поддержку (</span><span class="" style="font-family: Calibri;">помимо</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> публичного форума).</span></p>
  
  <p class="2 a DocDefaults "><span class="a0 " style="font-family: Cambria;">MergeDocx</span><span class="" style="font-family: Cambria;white-space:pre-wrap;"> и </span><span class="a0 " style="font-family: Cambria;">MergePptx</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Как описано в блоге по ссылке </span><a href="http://blogs.msdn.com/b/ericwhite/archive/2008/11/03/inserting-deleting-moving-paragraphs-in-open-xml-wordprocessing-documents.aspx"><span class="a6 a0 " style="color: #AD582A;"><span class="" style="font-family: Calibri;">Eric White</span><span class="" style="">’</span><span class="" style="font-family: Calibri;">s blog explained</span></span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /><span class="" style="font-family: Calibri;">, совмещение множества документов может быть затруднительным:</span></p>
  
  <p class="a8 a DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="a0 " style="color: #777777;font-size: 11.0pt;;font-family: Calibri;white-space:pre-wrap;">Эта программная задача усложняется </span><span class="a0 " style="color: #777777;font-size: 11.0pt;;font-family: Calibri;">необходимостью</span><span class="a0 " style="color: #777777;font-size: 11.0pt;"><span class="" style="font-family: Calibri;white-space:pre-wrap;"> в поддержании синхронизации других частей документа</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> с данными, хранящимися в параграфах. К примеру, параграф может содержать ссылку на комментарий в части комментариев и если имеется проблема с этой ссылкой, то документ будет не валидным. Необходимо быть аккуратным при перемещении /добавлении /удалении параграфов, чтобы поддерживать </span><span class="" style="">‘</span></span><span class="a0 " style="color: #777777;font-size: 11.0pt;;font-family: Calibri;">целостность</span><span class="a0 " style="color: #777777;font-size: 11.0pt;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="color: #777777;font-size: 11.0pt;;font-family: Calibri;">ссылок</span><span class="a0 " style="color: #777777;font-size: 11.0pt;">’ </span><span class="a0 " style="color: #777777;font-size: 11.0pt;;font-family: Calibri;">внутри</span><span class="a0 " style="color: #777777;font-size: 11.0pt;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="color: #777777;font-size: 11.0pt;;font-family: Calibri;">документа.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Коммерческое издание </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> включает код </span><span class="a0 " style="color: #000000;"><span class="" style="">“</span><span class="" style="font-family: Calibri;">MergeDocx</span><span class="" style="">”</span><span class="" style="font-family: Calibri;">, который даёт возможность соединять документы просто как вызвать метод:</span></span></p>
  
  <p class="a DocDefaults " style="position: relative; text-indent: 12mm;"><span class="HTML a0 " style="font-size: 8.0pt;;font-family: Calibri;">public</span><span class="a0 " style="font-size: 8.0pt;"><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Consolas;white-space:pre-wrap;"> </span></span><span class="HTML a0 " style="font-size: 8.0pt;"><span class="" style="font-family: Calibri;">WordprocessingMLPackage merge(List&lt;WordprocessingMLPackage&gt; wmlPkgs)</span></span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Другими словами, Вы передаёте список документов </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> и получаете один документ </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">обратно.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Чтобы попробовать это, посетите ссылку </span><a href="http://webapp.docx4java.org/"><span class="a6 a0 " style="font-family: Calibri;">http://webapp.docx4java.org/</span></a><span class="" style="font-family: Calibri;white-space:pre-wrap;" /></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Коммерческое издание </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> включает </span><span class="" style="font-family: Calibri;">расширение</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="" style="font-family: Calibri;">MergePptx, которое</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> можно использовать для </span><span class="" style="font-family: Calibri;">объединения</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> презентаций.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Расширение </span><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">MergeDocx может быть также использовано для обработки </span></span><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;">документов </span><span class="a0 " style="font-weight: bold;color: #000000;;font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, которые встроены как элементы </span><span class="aa a0 " style="color: #000000;;font-family: Calibri;">altChunk</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">. (Без расширения Вам необходимо полагаться на </span><span class="a0 " style="font-family: Calibri;">Word</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, чтобы конвертировать элемент </span><span class="aa a0 " style="font-weight: normal;color: #000000;;font-family: Calibri;white-space:pre-wrap;">altChunk </span><span class="aa a0 " style="font-weight: normal;color: #000000;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">в нормальный контент; </span></span><span class="aa a0 " style="font-weight: normal;color: #000000;;font-family: Calibri;white-space:pre-wrap;">это </span><span class="aa a0 " style="font-weight: normal;color: #000000;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">означает, если Ваш </span></span><span class="aa a0 " style="font-weight: normal;color: #000000;;font-family: Calibri;">docx</span><span class="aa a0 " style="font-weight: normal;color: #000000;;font-family: Calibri;white-space:pre-wrap;"> содержит </span><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">w:altChunk, Вам необходимо пропустить его через </span></span><span class="a0 " style="color: #000000;;font-family: Calibri;">Word,</span><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;white-space:pre-wrap;"> прежде чем </span></span><span class="a0 " style="color: #000000;;font-family: Calibri;">docx4j</span><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;"> может сделать из него </span><span class="a0 " style="color: #000000;;font-family: Calibri;">PDF</span><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;"> или </span><span class="a0 " style="color: #000000;;font-family: Calibri;">HTML.)</span></p>
  
  <p class="a DocDefaults "><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;">Для обработки элементов </span><span class="a0 " style="color: #000000;;font-family: Calibri;">w:altChunk</span><span class="a0 " style="color: #000000;;font-family: Calibri;white-space:pre-wrap;"> в документе </span><span class="a0 " style="color: #000000;;font-family: Calibri;">docx</span><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;">, Вы вызываете:</span></span></p>
  
  <p class="a DocDefaults " style="position: relative; text-indent: 12mm;"><span class="HTML a0 " style="font-size: 8.0pt;;font-family: Calibri;">public</span><span class="a0 " style="font-size: 8.0pt;;font-family: Calibri;white-space:pre-wrap;"> </span><span class="HTML a0 " style="font-size: 8.0pt;;font-family: Calibri;">WordprocessingMLPackage process(WordprocessingMLPackage srcPackage)</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Вы передаёте документ </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, который содержит элементы </span><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">altChunks, а на выходе получаете новый документ </span></span><span class="a0 " style="color: #000000;;font-family: Calibri;">docx</span><span class="a0 " style="color: #000000;"><span class="" style="font-family: Calibri;">, который уже не содержит их.</span></span></p>
  
  <p class="2 a DocDefaults "><span class="" style="font-family: Cambria;">Создание и обновление оглавления</span></p>
  
  <p class="a DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;"><span class="" style="font-family: Calibri;white-space:pre-wrap;">Минимальный код </span><span class="a0 " style="font-family: Calibri;">XML</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, который необходим </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> для вставки в документ </span><span class="a0 " style="font-weight: bold;color: #000000;;font-family: Calibri;">Microsoft Word</span><span class="" style="font-family: Calibri;white-space:pre-wrap;">, чтобы сгенерировать оглавление (включая ссылки и </span><span class="" style="font-family: Calibri;">связанные закладки):</span></p>
  
  <p class="a DocDefaults " style="border-color: #FCF9E0; border-style:solid; border-width:1px;background-color: #FCF9E0;margin-bottom: 3mm;line-height: 140%;"><span class="a0 " style="color: #000000;font-size: 8.5pt;;font-family: Courier New;">          &lt;w:p&gt;</span><span class="a0 " style="color: #000000;font-size: 8.5pt;"><br /><span class="" style="font-family: Courier New;">            &lt;w:r&gt;</span><br /><span class="" style="font-family: Courier New;">              &lt;w:fldChar w:fldCharType="begin" w:dirty="true"/&gt;</span><br /><span class="" style="font-family: Courier New;">            &lt;/w:r&gt;</span><br /><span class="" style="font-family: Courier New;">            &lt;w:r&gt;</span><br /><span class="" style="font-family: Courier New;">              &lt;w:instrText xml:space="preserve"&gt; TOC \o "1-3" \h \z \u &lt;/w:instrText&gt;</span><br /><span class="" style="font-family: Courier New;">            &lt;/w:r&gt;</span><br /><span class="" style="font-family: Courier New;">            &lt;w:r&gt;</span><br /><span class="" style="font-family: Courier New;">              &lt;w:fldChar w:fldCharType="end"/&gt;</span><br /></span><span class="a0 " style="color: #000000;font-size: 8.5pt;;font-family: Courier New;">            &lt;/w:r&gt;</span><span class="a0 " style="color: #000000;font-size: 8.5pt;"><br /><span class="" style="font-family: Courier New;white-space:pre-wrap;">          &lt;/w:p&gt;  </span></span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Сгенерировать номера страниц сложно без программы </span><span class="a0 " style="font-family: Calibri;">Word</span><span class="" style="font-family: Calibri;">.</span></p>
  
  <p class="a DocDefaults "><span class="" style="font-family: Calibri;white-space:pre-wrap;">Коммерческое расширение </span><span class="a0 " style="font-family: Calibri;">docx</span><span class="" style="font-family: Calibri;">4</span><span class="a0 " style="font-family: Calibri;">j</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> </span><span class="a0 " style="color: #000000;background-color: #FFFFFF;font-size: 10.0pt;;font-family: Arial;">TOC</span><span class="" style="font-family: Calibri;white-space:pre-wrap;"> содержит код для генерации и обновления оглавления, включая номера страниц, полученных на основании модели базового расположения страниц.</span></p></div>
  
  
  
  
  
  
  
  <!-- userBodyTail goes here -->
  
  </body></html>